JavaScript
A5.u.math.polartransform Method
Syntax
A5.u.math.polar.transform(angle,distance,point)
Arguments
- anglenumber
The angle in degrees to move the point along.
- distancenumber
The distance to move the point.
- pointobjectarray
The point to transform. If no point is passed in then an x/y value of 0 will be used. Can be an array, or an object with properties "x" and "y".
Returns
- pointobjectarray
The new location of the passed in point after transform.
Description
Perform a polar transform on a point.
Discussion
This method will transform a point along the given angle be a given distance. The point can be passed in as either an array where the first entry is the "x" value and the second entry is the "y", or and object with "x" and "y" properties. The resulting point will be in the same format (object or array) as in original point.
Example
var pnt = A5.u.math.polar.transform(15,20,[15,10]); // pnt = [34.31851652578136, 15.176380902050415] pnt = A5.u.math.polar.transform(15,20,{x: 15, y: 10}); // pnt = {x: 34.31851652578136, y: 15.176380902050415}